import javafx.scene.control.Label;


public class LevelManager {
    private int level;
    private int targetScore;
    private int multiplier;
    private Label levelLabel;
    private Label targetLabel;

    public LevelManager() {
        this.level = 1;
        this.targetScore = 1000;
        this.multiplier = 1;
    }
    public void nextLevel() {
        level++;
        targetScore = level * 1000;
        multiplier = Math.min(level, 5); // 最高乘数为5
        updateLabels();
    }
    public void reset() {
        level = 1;
        targetScore = 1000;
        multiplier = 1;
        updateLabels();
    }
    public int getLevel() {
        return level;
    }
    public int getCurrentLevel() {
        return level;
    }
    public int getTargetScore() {
        return targetScore;
    }
    public int getMultiplier() {
        return multiplier;
    }
    public void setLevelLabel(Label levelLabel) {
        this.levelLabel = levelLabel;
        updateLabels();
    }
    public void setTargetLabel(Label targetLabel) {
        this.targetLabel = targetLabel;
        updateLabels();
    }
    private void updateLabels() {
        if (levelLabel != null) {
            levelLabel.setText("" + level);
        }
        if (targetLabel != null) {
            targetLabel.setText("" + targetScore);
        }
    }
}

